package com.xiongwei.myspringbootproject.web.controller;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 *
 * @author XiongWei
 * @date 2021/11/14
 */
@Controller
public class PrometheusController {

    @Autowired
    MeterRegistry registry;

    @GetMapping("/register-test")
    @ResponseBody
    public String registerTest() {
        registry.counter("register-test", "from", "localhost",
                "method", "register-test").increment();

        return "ok";
    }

}
